﻿using Microsoft.EntityFrameworkCore;

namespace MeterReader.Models
{
    public class SimMeterDBContext : DbContext
    {
        /// <summary>
        /// 表对象
        /// </summary>
        public DbSet<TableMeters> TMeters { get; set; }

        /// <summary>
        /// 使用依赖注入方式必须得构造函数
        /// </summary>
        /// <param name="options"></param>
        public SimMeterDBContext(DbContextOptions<SimMeterDBContext> options)
            : base(options) { }

        // 普通方式
        //private string _connectionString;
        //public MeterDBContext(string connectionString)
        //{
        //    _connectionString = connectionString;
        //}
        //protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        //{
        //    base.OnConfiguring(optionsBuilder);
        //    //optionsBuilder.UseSqlite(_connectionString);
        //}
    }
}